package com.augrain.microframework.core.util.collection;


import java.util.HashMap;
import java.util.Map;

/**
 * MapUtils
 *
 * @author biaoy
 * @since 2020/11/25
 */
public class MapUtils {

    private MapUtils() {

    }

    /**
     * 返回一个空map
     *
     * @return map
     */
    public static Map<String, Object> empty() {
        return new HashMap<>();
    }

    /**
     * 是否为空
     *
     * @param map map
     * @return true/false
     */
    public static boolean isEmpty(Map<?, ?> map) {
        return map == null || map.isEmpty();
    }

    /**
     * 单key value Map
     */
    public static <K, V> Map<K, V> toMap(K key, V value) {
        Map<K, V> map = new HashMap<>();
        map.put(key, value);
        return map;
    }
}
